﻿using Polly;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Reflection;

namespace Leo.Core.Abp.Client
{
    public abstract class BaseHttpApiClientOptions
    {
        // Contracts 程序集
        public abstract Type HttpApiClientContractsModuleType { get; set; }

        public abstract string RemoteServiceName { get; set; }
        public string RemoteSectionName
        {
            get
            {
                return $"RemoteServices:{RemoteServiceName}:BaseUrl";
            }
        }

   
        public Func<DelegatingHandler> DelegatingHandlerFunc { get; set; }

 
        public Func<PolicyBuilder<HttpResponseMessage>, IAsyncPolicy<HttpResponseMessage>> HttpErrorPolicy { get; set; }

 
        public Func<IServiceProvider, HttpRequestMessage, IAsyncPolicy<HttpResponseMessage>> PolicySelector { get; set; }

        public List<Assembly> ContractsAssemblies { get; set; } = new List<Assembly>();

        public BaseHttpApiClientOptions()
        {
            ContractsAssemblies.Add(HttpApiClientContractsModuleType.Assembly);
        }
    }
}
